import {defineStore} from "pinia";
import {onMounted, ref} from "vue";
import {getItemList} from "@/apis/item.js";

export const getItemStore
    = defineStore('item', () => {
        const itemList = ref([])
        const item = async (id)=>{
            const res = await getItemList(id)
            itemList.value = res.data
            console.log(id)
        }
        // 页面渲染时重新加载
        onMounted(() => item())
    return {itemList, item}
    }

)

